// AUTO GENERATED CODE!
// CODE GENERATOR WILL NOT PRESERVE MANUAL CHANGES TO THIS CODE!
// 

// MIT License (MIT)
// 
// Copyright (c) 2014 K Ercan Turkarslan
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
// 


using System;

namespace Mios.Generated.ServiceFiles
{
    // Generated from S_HVAC_FanOperatingMode1.xml
    
    public class HVAC_FanOperatingMode1Service : MiosService
    {
        #region Mode : String;
        private String _mMode;
        
        public String Mode
        {
            get
            {
                return _mMode ?? GetMode();
            }
        }
        
        #region Action SetMode(String newMode) : String;
        public String SetMode(String newMode)
        {
            if (String.IsNullOrEmpty(newMode))
                throw new ArgumentNullException("newMode");
            
            switch(newMode)
            {
                case "Auto":
                case "ContinuousOn":
                case "PeriodicOn":
                    break;
                
                default:
                    throw new ArgumentOutOfRangeException("newMode");
            }
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetMode",
                String.Format("NewMode={0}", ToLuup(_mMode = newMode)));
        }
        #endregion Action SetMode
        
        #region Action GetMode() : String;
        public String GetMode()
        {
            _mMode = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Mode"));
            
            return _mMode;
        }
        #endregion Action GetMode
        
        #endregion
        
        #region FanStatus : String;
        private String _mFanStatus;
        
        public String FanStatus
        {
            get
            {
                return _mFanStatus ?? GetFanStatus();
            }
        }
        
        #region Action SetFanStatus(String newFanStatus) : String;
        public String SetFanStatus(String newFanStatus)
        {
            if (String.IsNullOrEmpty(newFanStatus))
                throw new ArgumentNullException("newFanStatus");
            
            switch(newFanStatus)
            {
                case "On":
                case "Off":
                    break;
                
                default:
                    throw new ArgumentOutOfRangeException("newFanStatus");
            }
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetFanStatus",
                String.Format("newFanStatus={0}", ToLuup(_mFanStatus = newFanStatus)));
        }
        #endregion Action SetFanStatus
        
        #region Action GetFanStatus() : String;
        public String GetFanStatus()
        {
            _mFanStatus = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "FanStatus"));
            
            return _mFanStatus;
        }
        #endregion Action GetFanStatus
        
        #endregion
        
        #region Name : String;
        private String _mName;
        
        public String Name
        {
            get
            {
                return _mName ?? GetName();
            }
        }
        
        #region Action SetName(String newName) : String;
        public String SetName(String newName)
        {
            if (String.IsNullOrEmpty(newName))
                throw new ArgumentNullException("newName");
            
            return Engine.Luup_CallAction(base.DeviceId, base.ServiceId, "SetName",
                String.Format("NewName={0}", ToLuup(_mName = newName)));
        }
        #endregion Action SetName
        
        #region Action GetName() : String;
        public String GetName()
        {
            _mName = FromLuupString(Engine.Luup_VariableGet(base.DeviceId, base.ServiceId, "Name"));
            
            return _mName;
        }
        #endregion Action GetName
        
        #endregion
        
        
        #region Method SetVariable(String name, String value) : Boolean;
        internal override Boolean SetVariable(String name, String value)
        {
            switch(name)
            {
                case "FanStatus":
                    _mFanStatus = FromLuupString(value); return true;
                case "Mode":
                    _mMode = FromLuupString(value); return true;
                case "Name":
                    _mName = FromLuupString(value); return true;
                default:
                    return false;
            }
        }
        #endregion Method SetVariable
        
        public HVAC_FanOperatingMode1Service(MiosEngine engine, UInt32 deviceId, String serviceId)
            : base(engine, deviceId, serviceId)
        {
            
        } //End Constructor
    } //End of class
} //End of Namespace

